package com.cmy.service;

import com.cmy.dao.BookMapper;
import com.cmy.pojo.Books;

import java.util.List;
import java.util.Map;

public class BookServiceImpl implements BookService{

    //service调dao层:组合dao层
    private BookMapper bookMapper;
    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public int addBook(Books books) {
        return bookMapper.addBook(books);
    }

    public int delBookById(int id) {
        return bookMapper.delBookById(id);
    }

    public int updateBook(Books books) {
        return bookMapper.updateBook(books);
    }

    public Books queryBookById(int id) {
        return bookMapper.queryBookById(id);
    }

    //模糊查询
    public List<Books> queryBookByName(String bookName) {
        return bookMapper.queryBookByName("%"+bookName+"%");
    }

    public List<Books> queryAllBooks() {
        return bookMapper.queryAllBooks();
    }
}

    